﻿using System;
using UnityEngine;

// Token: 0x020000A2 RID: 162
public class MMD4MecanimBone : MonoBehaviour
{
	// Token: 0x17000099 RID: 153
	// (get) Token: 0x060003C7 RID: 967 RVA: 0x0001D56F File Offset: 0x0001B76F
	public MMD4MecanimData.BoneData boneData
	{
		get
		{
			return this._boneData;
		}
	}

	// Token: 0x1700009A RID: 154
	// (get) Token: 0x060003C8 RID: 968 RVA: 0x0001D577 File Offset: 0x0001B777
	// (set) Token: 0x060003C9 RID: 969 RVA: 0x0001D57F File Offset: 0x0001B77F
	public Vector3 userPosition
	{
		get
		{
			return this._userPosition;
		}
		set
		{
			if (this._userPosition != value)
			{
				this._userPosition = value;
				this._userPositionIsZero = MMD4MecanimCommon.FuzzyZero(value);
			}
		}
	}

	// Token: 0x1700009B RID: 155
	// (get) Token: 0x060003CA RID: 970 RVA: 0x0001D5A5 File Offset: 0x0001B7A5
	// (set) Token: 0x060003CB RID: 971 RVA: 0x0001D5B0 File Offset: 0x0001B7B0
	public Vector3 userEulerAngles
	{
		get
		{
			return this._userEulerAngles;
		}
		set
		{
			if (this._userEulerAngles != value)
			{
				if (MMD4MecanimCommon.FuzzyZero(value))
				{
					this._userRotation = Quaternion.identity;
					this._userEulerAngles = Vector3.zero;
					this._userRotationIsIdentity = true;
				}
				else
				{
					this._userRotation = Quaternion.Euler(value);
					this._userEulerAngles = value;
					this._userRotationIsIdentity = false;
				}
			}
		}
	}

	// Token: 0x1700009C RID: 156
	// (get) Token: 0x060003CC RID: 972 RVA: 0x0001D615 File Offset: 0x0001B815
	// (set) Token: 0x060003CD RID: 973 RVA: 0x0001D620 File Offset: 0x0001B820
	public Quaternion userRotation
	{
		get
		{
			return this._userRotation;
		}
		set
		{
			if (this._userRotation != value)
			{
				if (MMD4MecanimCommon.FuzzyIdentity(value))
				{
					this._userRotation = Quaternion.identity;
					this._userEulerAngles = Vector3.zero;
					this._userRotationIsIdentity = true;
				}
				else
				{
					this._userRotation = value;
					this._userEulerAngles = value.eulerAngles;
					this._userRotationIsIdentity = false;
				}
			}
		}
	}

	// Token: 0x060003CE RID: 974 RVA: 0x0001D688 File Offset: 0x0001B888
	public void Setup()
	{
		if (this.model == null || this.model.modelData == null || this.model.modelData.boneDataList == null || this.boneID < 0 || this.boneID >= this.model.modelData.boneDataList.Length)
		{
			return;
		}
		this._boneData = this.model.modelData.boneDataList[this.boneID];
	}

	// Token: 0x060003CF RID: 975 RVA: 0x0001D712 File Offset: 0x0001B912
	public void Bind()
	{
		if (this.model == null || this._boneData == null)
		{
			return;
		}
	}

	// Token: 0x060003D0 RID: 976 RVA: 0x0001D731 File Offset: 0x0001B931
	public void Destroy()
	{
		this._boneData = null;
	}

	// Token: 0x0400052E RID: 1326
	public MMD4MecanimModel model;

	// Token: 0x0400052F RID: 1327
	public int boneID = -1;

	// Token: 0x04000530 RID: 1328
	public bool ikEnabled;

	// Token: 0x04000531 RID: 1329
	public float ikWeight = 1f;

	// Token: 0x04000532 RID: 1330
	[NonSerialized]
	public int humanBodyBones = -1;

	// Token: 0x04000533 RID: 1331
	private MMD4MecanimData.BoneData _boneData;

	// Token: 0x04000534 RID: 1332
	[NonSerialized]
	public Vector3 _userPosition = Vector3.zero;

	// Token: 0x04000535 RID: 1333
	[NonSerialized]
	public Vector3 _userEulerAngles = Vector3.zero;

	// Token: 0x04000536 RID: 1334
	[NonSerialized]
	public Quaternion _userRotation = Quaternion.identity;

	// Token: 0x04000537 RID: 1335
	[NonSerialized]
	public bool _userPositionIsZero = true;

	// Token: 0x04000538 RID: 1336
	[NonSerialized]
	public bool _userRotationIsIdentity = true;
}
